<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@include file="common/header.jsp"%>
<div class="clearfix"></div>
<div class="row">

  <div class="col-md-12">
    <div class="x_panel">
      <div class="x_title">
        <h2>
          APP 分类管理 <i class="fa fa-user"></i><small>${userSession.userName}
          - 您可以通过搜索或者其他的筛选项对APP的分类信息进行管理。^_^</small>
        </h2>
        <div class="clearfix"></div>
      </div>
      <div class="x_content">
        <form method="post" action="toAppClassification">
          <input type="hidden" name="pageIndex" value="1" />
          <ul>
            <li>
              <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">一级分类</label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                  <select id="queryCategoryLevel1" name="queryCategoryLevel1" class="form-control">
                    <c:if test="${categoryLevel1List != null }">
                      <option value="">--请选择--</option>
                      <c:forEach var="appCategory" items="${categoryLevel1List}">
                        <option <c:if test="${appCategory.id == queryCategoryLevel1 }">selected="selected"</c:if>
                                value="${appCategory.id}">${appCategory.categoryName}</option>
                      </c:forEach>
                    </c:if>
                  </select>
                </div>
              </div>
            </li>
            <li>
              <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">二级分类</label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                  <input type="hidden" name="categorylevel2list" id="categorylevel2list"/>
                  <select name="queryCategoryLevel2" id="queryCategoryLevel2" class="form-control">
                    <c:if test="${categoryLevel2List != null }">
                      <option value="">--请选择--</option>
                      <c:forEach var="appCategory" items="${categoryLevel2List}">
                        <option <c:if test="${appCategory.id == queryCategoryLevel2 }">selected="selected"</c:if>
                                value="${appCategory.id}">${appCategory.categoryName}</option>
                      </c:forEach>
                    </c:if>
                  </select>
                </div>
              </div>
            </li>
            <li>
              <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">三级分类</label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                  <select name="queryCategoryLevel3" id="queryCategoryLevel3" class="form-control">
                    <c:if test="${categoryLevel3List != null }">
                      <option value="">--请选择--</option>
                      <c:forEach var="appCategory" items="${categoryLevel3List}">
                        <option <c:if test="${appCategory.id == queryCategoryLevel3 }">selected="selected"</c:if>
                                value="${appCategory.id}">${appCategory.categoryName}</option>
                      </c:forEach>
                    </c:if>
                  </select>
                </div>
              </div>
            </li>
            <li><button type="submit" class="btn btn-primary"> 查 &nbsp;&nbsp;&nbsp;&nbsp;询 </button></li>
          </ul>
        </form>
      </div>
    </div>
  </div>
  <div class="col-md-12 col-sm-12 col-xs-12">
    <div class="x_panel">
      <div class="x_content">
        <p class="text-muted font-13 m-b-30"></p>
        <div id="datatable-responsive_wrapper"
             class="dataTables_wrapper form-inline dt-bootstrap no-footer">
          <div class="row">
            <div class="col-sm-12">
              <table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap dataTable no-footer dtr-inline collapsed"
                     cellspacing="0" width="100%" role="grid" aria-describedby="datatable-responsive_info" style="width: 100%;">
                <thead>
                <tr role="row">
                  <th class="sorting" tabindex="0"
                      aria-controls="datatable-responsive" rowspan="1" colspan="1"
                      style="width:400px;"
                      aria-label="Last name: activate to sort column ascending">
                    分类名称</th>
                  <th class="sorting" tabindex="0"
                      aria-controls="datatable-responsive" rowspan="1" colspan="1"
                      style="width: 400px;"
                      aria-label="Last name: activate to sort column ascending">
                    所属分类(一级分类、二级分类、三级分类)</th>
                  <th class="sorting" tabindex="0"
                      aria-controls="datatable-responsive" rowspan="1" colspan="1"
                      style="width: 400px;"
                      aria-label="Last name: activate to sort column ascending">
                    操作
                  </th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="appCategory" items="${appCategoryList }">
                  <tr role="row" class="odd">
                    <td>${appCategory.categoryName}</td>
                    <td>${appCategory.parentName}</td>
                    <td>
                      <button type="button" class="btn btn-default addClassificationBtn" appCategoryId="${appCategory.id}" data-toggle="tooltip" data-placement="top" title="" data-original-title="添加分类">添加分类</button>
                      <button type="button" class="btn btn-default checkApp"
                              appinfoid="${appInfo.id }" versionid="${appInfo.versionId }" status="${appInfo.status }"
                              statusname="${appInfo.statusName }"
                              data-toggle="tooltip" data-placement="top" title="" data-original-title="修改分类">修改分类</button>
                      <button type="button" class="btn btn-default checkApp"
                              appinfoid="${appInfo.id }" versionid="${appInfo.versionId }" status="${appInfo.status }"
                              statusname="${appInfo.statusName }"
                              data-toggle="tooltip" data-placement="top" title="" data-original-title="删除分类">删除分类</button>
                    </td>
                  </tr>
                </c:forEach>
                </tbody>
              </table>
            </div>
          </div>
          <div class="row">
            <div class="col-sm-5">
              <div class="dataTables_info" id="datatable-responsive_info"
                   role="status" aria-live="polite">共${pages.totalCount }条记录
                ${pages.currentPageNo }/${pages.totalPageCount }页</div>
            </div>
            <div class="col-sm-7">
              <div class="dataTables_paginate paging_simple_numbers"
                   id="datatable-responsive_paginate">
                <ul class="pagination">
                  <c:if test="${pages.currentPageNo > 1}">
                    <li class="paginate_button previous"><a
                            href="javascript:page_nav(document.forms[0],1);"
                            aria-controls="datatable-responsive" data-dt-idx="0"
                            tabindex="0">首页</a>
                    </li>
                    <li class="paginate_button "><a
                            href="javascript:page_nav(document.forms[0],${pages.currentPageNo-1});"
                            aria-controls="datatable-responsive" data-dt-idx="1"
                            tabindex="0">上一页</a>
                    </li>
                  </c:if>
                  <c:if test="${pages.currentPageNo < pages.totalPageCount }">
                    <li class="paginate_button "><a
                            href="javascript:page_nav(document.forms[0],${pages.currentPageNo+1 });"
                            aria-controls="datatable-responsive" data-dt-idx="1"
                            tabindex="0">下一页</a>
                    </li>
                    <li class="paginate_button next"><a
                            href="javascript:page_nav(document.forms[0],${pages.totalPageCount });"
                            aria-controls="datatable-responsive" data-dt-idx="7"
                            tabindex="0">最后一页</a>
                    </li>
                  </c:if>
                </ul>
              </div>
            </div>
          </div>
        </div>

      </div>
    </div>
  </div>
</div>
<%@include file="common/footer.jsp"%>
<script src="${pageContext.request.contextPath }/statics/localjs/rollpage.js"></script>
<script src="${pageContext.request.contextPath }/statics/localjs/appclassification.js"></script>
<script src="${pageContext.request.contextPath }/statics/localjs/applist.js"></script>